<!DOCTYPE html>
<html>
<div th:replace="common/jsCssRef :: jsfJsCssRef"></div>
<body class="bgf6">

<div th:replace="common/head :: jsfHeader"></div>

<div class="main-body pb100">
    <div class="container pt10">
        <div class="dflx sbt" id="app">
            <div th:replace="common/left :: jsfLeft"></div>

            <div class="body-right">
                <div class="bread-nav bgff">
                    <ul class="dflx">
                        <li><a href="">首页</a></li>
                        <li><a href="">统筹规划</a></li>
                        <li><a href="/view/developPlan">全市发展规划</a></li>
                        <li><a href="###">编辑</a></li>
                    </ul>
                </div>

                <div class="bgff mt10 pb20 edit-mode">
                    <form class="wrap" id="form">

                        <div class="box">
                            <div class="box-title"><span>中长期项目基本信息</span></div>
                            <div class="mt20 f14 long">
                                <div class="two">
                                    <span class="title">项目名称</span>
                                    <div class="content">
                                        <input type="text" id="projectName" name="projectName" v-model="plan.projectName" class="form-control" value=""
                                               placeholder="请输入项目名称"/>
                                    </div>
                                    <span class="title">项目编号</span>
                                    <div class="content">
                                        <input type="text"  id="projectNo" name="projectNo" v-model="plan.projectNo" class="form-control" value=""
                                               placeholder="请输入项目编号"/>
                                    </div>
                                </div>

                                <div class="two">
                                    <span class="title">项目编码</span>
                                    <div class="content">
                                        <input type="text" id="uniqueCityCode" name="uniqueCityCode" v-model="plan.uniqueCityCode" class="form-control" value=""
                                               placeholder="请输入项目编号"/>
                                    </div>
                                    <span class="title">项目总投资</span>
                                    <div class="content">
                                        <input type="text" id="totalProjectInvestment" name="totalProjectInvestment" v-model="plan.totalProjectInvestment" class="form-control" value=""
                                               placeholder="单位为万元"/>
                                    </div>
                                </div>
                                <div class="two">
                                    <span class="title">项目类型</span>
                                    <div class="content">
                                        <select id="project" name="projectCategoryName" v-model="plan.projectCategoryName" class="form-control c999">
                                            <option value='' disabled selected class='none'>请选择项目类型</option>
                                            <option value="1">全市</option>
                                            <option value="2">专项</option>
                                        </select>
                                    </div>
                                    <span class="title">建设地点</span>
                                    <div class="content">
                                        <input type="text" id="constructionSite" name="constructionSite" v-model="plan.constructionSite" class="form-control" value=""
                                               placeholder="建设地点"/>
                                    </div>
                                </div>
                                <div class="two">
                                    <span class="title">计划开始时间</span>
                                    <div class="content">
                                        <div class="input-group">
                                            <input type="text" name="planBeginTime" v-model="plan.planBeginTime" class="form-control" placeholder="请选择年份"
                                                   id="planBeginTime" value="">
                                        </div>
                                    </div>
                                    <span class="title">计划截止时间</span>
                                    <div class="content">
                                        <div class="input-group">
                                            <input type="text" name="planEndTime" v-model="plan.planEndTime" class="form-control" placeholder="请选择年份" id="planEndTime"
                                                   value="">
                                        </div>
                                    </div>
                                </div>
                                <div class="two">
                                    <span class="title">所属单位</span>
                                    <div class="content">
                                        <select id="belongUnitName" name="belongUnitName" v-model="plan.belongUnitName" class="form-control c999">
                                            <option value='' disabled selected class='none'>所属编制单位</option>
                                            <option value="1">民政局</option>
                                            <option value="2">公安局</option>
                                        </select>
                                    </div>
                                    <span class="title">项目联系人</span>
                                    <div class="content">
                                        <input type="text" id="projectContact" name="projectContact" v-model="plan.projectContact" class="form-control" value=""
                                               placeholder="联系人"/>
                                    </div>
                                </div>
                                <div class="two">
                                    <span class="title">联系人电话</span>
                                    <div class="content">
                                        <input type="text" id="projectContactMobile" name="projectContactMobile" v-model="plan.projectContactMobile" class="form-control" value=""
                                               placeholder="请输入项目联系人电话"/>
                                    </div>
                                    <span class="title">联系人邮箱</span>
                                    <div class="content">
                                        <input type="text" id="projectContactEmail" name="projectContactEmail" v-model="plan.projectContactEmail" class="form-control" value=""
                                               placeholder="请输入项目联系人电话"/>
                                    </div>
                                </div>

                                <div class="two">
                                    <span class="title">国标行业编码</span>
                                    <div class="content">
                                        <select id="prjIndustry" name="industryCoding" v-model="plan.industryCoding" class="form-control c999">
                                            <option value='' disabled selected class='none'>所属编制单位</option>
                                            <option value="1">民政局</option>
                                            <option value="2">公安局</option>
                                        </select>
                                    </div>

                                    <span class="title">国标行业名称</span>
                                    <div class="content">
                                        <input type="text" name="industryName" v-model="plan.industryName" class="form-control" value="" placeholder="请输入国标行业名称"/>
                                    </div>
                                </div>
                                <div class="two">
                                    <span class="title">是否开发区项目</span>
                                    <div class="content">
                                        <select name="isDevelopment" v-model="plan.isDevelopment" class="form-control c999">
                                            <option value='' disabled selected class='none'>所属编制单位</option>
                                            <option value="1">是</option>
                                            <option value="2">否</option>
                                        </select>
                                    </div>
                                    <span class="title">开发区名称</span>
                                    <div class="content">
                                        <input type="text" name="developmentName" v-model="plan.developmentName" class="form-control" value="" placeholder="请输入开发区名称"/>
                                    </div>
                                </div>
                                <div class="two">
                                    <span class="title">产业结构编码</span>
                                    <div class="content">
                                        <select name="industrialStructureCode" v-model="plan.industrialStructureCode" class="form-control c999">
                                            <option value='' disabled selected class='none'>产业结构编码</option>
                                            <option value="1">是</option>
                                            <option value="2">否</option>
                                        </select>
                                    </div>
                                    <span class="title">产业结构名称</span>
                                    <div class="content">
                                        <input type="text" name="industrialStructureName" v-model="plan.industrialStructureName" class="form-control" value="" placeholder="请输入产业结构名称"/>
                                    </div>
                                </div>
                                <div class="two">
                                    <span class="title">行政区划编码</span>
                                    <div class="content">
                                        <select name="administrativeDivisionCode" v-model="plan.administrativeDivisionCode" class="form-control c999">
                                            <option value='' disabled selected class='none'>行政区划编码</option>
                                            <option value="1">是</option>
                                            <option value="2">否</option>
                                        </select>
                                    </div>
                                    <span class="title">行政区划名称</span>
                                    <div class="content">
                                        <input type="text" name="administrativeDivisionName" v-model="plan.administrativeDivisionName" class="form-control" value="" placeholder="请输入产业结构名称"/>
                                    </div>
                                </div>
                                <div class="two">
                                    <span class="title">工程分类编码</span>
                                    <div class="content">
                                        <select name="projectClassificationCode" v-model="plan.projectClassificationCode" class="form-control c999">
                                            <option value='' disabled selected class='none'>工程分类编码</option>
                                            <option value="1">是</option>
                                            <option value="2">否</option>
                                        </select>
                                    </div>
                                    <span class="title">工程分类名称</span>
                                    <div class="content">
                                        <input type="text" name="projectClassificationName" v-model="plan.projectClassificationName" class="form-control" value="" placeholder="请输入工程分类名称"/>
                                    </div>
                                </div>
                                <div class="two">
                                    <span class="title">立项类型编码</span>
                                    <div class="content">
                                        <select name="approvalTypeCode" v-model="plan.approvalTypeCode" class="form-control c999">
                                            <option value='' disabled selected class='none'>立项类型编码</option>
                                            <option value="1">是</option>
                                            <option value="2">否</option>
                                        </select>
                                    </div>
                                    <span class="title">立项类型名称</span>
                                    <div class="content">
                                        <input type="text" name="approvalTypeName" v-model="plan.approvalTypeName" class="form-control" value="" placeholder="请输入立项类型名称"/>
                                    </div>
                                </div>
                                <div class="two">
                                    <span class="title">项目资金属性编码</span>
                                    <div class="content">
                                        <select name="fundAttributeCode" v-model="plan.fundAttributeCode" class="form-control c999">
                                            <option value='' disabled selected class='none'>项目资金属性编码</option>
                                            <option value="1">是</option>
                                            <option value="2">否</option>
                                        </select>
                                    </div>
                                    <span class="title">项目资金属性名称</span>
                                    <div class="content">
                                        <input type="text" name="fundAttributeName" v-model="plan.fundAttributeName" class="form-control" value="" placeholder="请输入项目资金属性名称"/>
                                    </div>
                                </div>
                                <div class="two">
                                    <span class="title">项目建设性质编码</span>
                                    <div class="content">
                                        <select name="constructionNatureCode" v-model="plan.constructionNatureCode" class="form-control c999">
                                            <option value='' disabled selected class='none'>项目建设性质编码</option>
                                            <option value="1">是</option>
                                            <option value="2">否</option>
                                        </select>
                                    </div>
                                    <span class="title">项目建设性质名称</span>
                                    <div class="content">
                                        <input type="text" name="constructionNatureName" v-model="plan.constructionNatureName" class="form-control" value="" placeholder="请输入项目建设性质名称"/>
                                    </div>
                                </div>
                                <div class="two">
                                    <span class="title">项目类别编码</span>
                                    <div class="content">
                                        <select name="itemCategoryCode" v-model="plan.itemCategoryCode" class="form-control c999">
                                            <option value='' disabled selected class='none'>项目类别编码</option>
                                            <option value="1">是</option>
                                            <option value="2">否</option>
                                        </select>
                                    </div>
                                    <span class="title">项目类别名称</span>
                                    <div class="content">
                                        <input type="text" name="itemCategoryName" v-model="plan.itemCategoryName" class="form-control" value="" placeholder="请输入项目类别名称"/>
                                    </div>
                                </div>
                                <div class="one">
                                    <span class="title">上传附件</span>
                                    <div class="content">
                                        <input type="file" class="filestyle" data-input="false" id="filestyle-1"
                                               tabindex="-1"
                                               style="position: absolute; clip: rect(0px, 0px, 0px, 0px);">
                                        <div class="bootstrap-filestyle input-group">
                        						<span class="group-span-filestyle" tabindex="0">
                        							<label for="filestyle-1" class="btn btn-white ">
                        							<span class="icon-cloud-upload"></span>
                        							<span class="buttonText">选择上传文件</span></label>
                        						</span>
                                        </div>
                                        <p class="f12 c999 mt3">
                                            只能上传jpg/png/word/pdf/zip/excle/ppt格式文件，文件不能超过50MB</p>
                                    </div>
                                </div>
                                <div class="one">
                                    <span class="title">建设内容</span>
                                    <div class="content">
                                            <textarea id="remark" name="remark" v-model="plan.remark" class="form-control" placeholder="请输入内容"
                                                      rows="" cols=""></textarea>
                                    </div>
                                </div>
                            </div>

                            <div class="tc mt40">
                                <button type="button" class="btn btn-white f12"> 取消</button>
                                <button type="button" onclick="add();" class="btn btn-primary f12"> 提交</button>
                                <button type="button" v-if="plan.currentState == 1" onclick="save();" class="btn btn-white f12"> 保存</button>
                            </div>

                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>


<script type="text/javascript">
    $('#planBeginTime').fdatepicker({format: 'yyyy-mm-dd'});
    $('#planEndTime').fdatepicker({format: 'yyyy-mm-dd'});
    $('#compileTime').fdatepicker({format: 'yyyy-mm-dd'});
    $('#auditTime').fdatepicker({format: 'yyyy-mm-dd'});
    $('#approvalTime').fdatepicker({format: 'yyyy-mm-dd'});

    var statusCaoGao = 1;//草稿
    var statusTiJiao = 2;//已提交

    var planId = $.getUrlParam("id");

    var appPage = new Vue({
        el : '#app',
        data : {
            plan : {}
        },
        created : function() {
            loadPlanInfo();
        },
        computed : {

        },
        methods : {
            planStatusDesc : function (val) {
                return statusPlanObj[val];
            }
        }
    })

    function submitPlan() {
        processSavePlan(2);
    }

    function savePlan() {
        processSavePlan(1);
    }

    function processSavePlan(currentState) {
        let params = $("#form").serializeObject();
        let p = {
            'currentState': 2,
            'auditResult': -1,
            'createMode': 1,
            'isDelete': 1,
            'approvalPerson': '',
            'isApproval': 1
        }
        $.extend(params,p);

        $.ajax({
            'url' : contentPath + '/mediumLongTermpm/update',
            'dataType' : 'json',
            'type' : 'post',
            'contentType':'application/json',
            'data' : JSON.stringify(params),
            'success' : function (result) {
                if (result.code != 1000) {
                    alert(result.msg);
                    if (result.code == 5555) {
                        window.location.href = contentPath;
                    }
                    return;
                }

                appPage.$message({
                    message: currentState == 1 ? '保存成功' : '提交成功',
                    type: 'success'
                });

                window.location.href = contentPath + '/view/toMediumlang';
            },
            'error' : function (result) {
            }
        });
    }


    function loadPlanInfo() {
        $.ajax({
            'url' : contentPath + '/mediumLongTermpm/getOne',
            'dataType' : 'json',
            'type' : 'get',
            'data' : {
                id : planId
            },
            'success' : function (result) {
                if (result.code != 1000) {
                    alert(result.message);
                    return;
                }

                appPage.plan = result.data;
            },
            'error' : function (result) {
            }
        });
    }


</script>
</body>
</html>
